import http from "../index";

// 分页获取满减信息
export const getFullReductions = ({
    ascended = null,
    current = null,
    size = null,
    sortFieldName = null,
    status = null,
    couponName = null,
    sendOut = null,
}) => {
    return http.get("full-reduction", {
        ascended,
        current,
        size,
        sortFieldName,
        status,
        couponName,
        sendOut,
    });
};

// 根据sid获取满减信息
export const getFullReductionDetail = ({ sid }) => {
    return http.get("full-reduction/" + sid);
};

// 新增满减
export const addFullReduction = ({
    minAmount,
    preferential,
    status = null,
    note = null,
}) => {
    return http.post("full-reduction", {
        minAmount,
        preferential,
        status,
        note,
    });
};

// 修改满减
export const editFullReduction = ({
    sid,
    minAmount,
    preferential,
    status = null,
    note = null,
}) => {
    return http.put("full-reduction/" + sid, {
        minAmount,
        preferential,
        status,
        note,
    });
};

// 批量删除满减
export const delFullReductions = ({ sidList }) => {
    return http.put("full-reduction/delete", { sidList });
};

// 根据sid发放某满减
export const grantFullReduction = ({ sid }) => {
    return http.put("full-reduction/" + sid + "/grant");
};

// 根据sid启用-停用满减
export const changeFullReductionStatus = ({ sid }) => {
    return http.put("full-reduction/" + sid + "/status");
};
